<?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'category-form',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
        'htmlOptions' => array(
            'class' => 'form-horizontal',
             'enctype' => 'multipart/form-data'
        ),
    ));
?>
<div class="row-fluid">
    <div class="span12">
        <!--PAGE CONTENT BEGINS-->
                <div class="control-group">
                    <?php echo $form->labelEx($translate, 'language_id', array('class' => 'control-label')); ?>
                    <div class="controls">

                         <?php echo $form->dropDownlist($translate, 'language_id', MyFunctionCustom::getDropdownlistLanguage(),array('class' => 'span5', 'placeholder' => 'Language')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'language_id'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelEx($model, 'event_code', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($model, 'event_code', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Event code')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'event_code'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($translate, 'main_title', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($translate, 'main_title', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Main title')); ?>
                        <span class="help-inline"><?php echo $form->error($translate, 'main_title'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($translate, 'sub_title', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($translate, 'sub_title', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Sub title')); ?>
                        <span class="help-inline"><?php echo $form->error($translate, 'sub_title'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($translate, 'location', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($translate, 'location', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Location')); ?>
                        <span class="help-inline"><?php echo $form->error($translate, 'location'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($translate, 'address', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($translate, 'address', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Address')); ?>
                        <span class="help-inline"><?php echo $form->error($translate, 'address'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($model, 'contact', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($model, 'contact', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Contact')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'contact'); ?></span>
                    </div>
                </div>
        
                <div class="control-group">
                   <?php echo $form->labelex($model, 'start_date', array('class' => 'control-label')); ?>
                   <div class="controls">
                               <div class="row-fluid input-append">
                                        <?php echo $form->textField($model, 'start_date',array('data-date-format'=>'dd-mm-yyyy','class'=>'date-picker')); ?>
                                       <span class="add-on">
                                               <i class="icon-calendar"></i>
                                       </span>
                                   <span class="help-inline"><?php echo $form->error($model, 'expired_date'); ?></span>
                               </div>
                   </div>
               </div>       
        
                <div class="control-group">
                    <?php echo $form->labelex($model, 'start_time', array('class' => 'control-label')); ?>
                    <div class="controls">
                                    <div class="input-append bootstrap-timepicker">
                                            <?php echo $form->textField($model, 'start_time',array('class'=>'input-small timepicker1')); ?>
                                            <span class="add-on">
                                                    <i class="icon-time"></i>
                                            </span>
                                    </div>
                        <span class="help-inline"><?php echo $form->error($model, 'start_time'); ?></span>
                    </div>
                </div>
        

                <div class="control-group">
                    <?php echo $form->labelex($model, 'fileImage', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->fileField($model, 'fileImage', array('class' => 'id-input-file-1 span5')); ?>
                        <span class="help-inline" style="float:left;margin-left:390px;"><?php echo $form->error($model, 'fileImage'); ?></span>
                    </div>
                </div>

                <div class="control-group">
                    <?php echo $form->labelex($model, 'priority', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->textField($model, 'priority', array('size' => 60, 'maxlength' => 255, 'class' => 'span5', 'placeholder' => 'Priority')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'priority'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($model, 'tag', array('class' => 'control-label')); ?>
                    <div class="controls">
                         <?php echo $form->textField($model, 'tag', array('data-role' => 'tagsinput', 'class' => 'span5','placeholder'=>'Add tag')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'tag'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelEx($model, 'category_id', array('class' => 'control-label')); ?>
                    <div class="controls">
                         <?php echo $form->dropDownlist($model, 'category_id', MyFunctionCustom::getDropdownlistCategoryEvent(),array('class' => 'span5', 'placeholder' => 'Language')); ?>
                        <span class="help-inline"><?php echo $form->error($model, 'category_id'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($model, 'gallery_id', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <div  id="gallary-tmp" style="margin-bottom:10px;">
                            <?php if($model->gallery_id !=''): 
                                 $gallery = Item::model()->with('gallery')->findByAttributes(array('gallery_id'=>$model->gallery_id));
                                 if($gallery):
                            ?>
                            <img src="<?php echo Yii::app()->baseUrl; ?>/timthumb.php?src=<?php echo Yii::app()->baseUrl; ?>/data/image/event/<?php echo $gallery->name; ?>&h=150&w=150" />
                            <?php endif;endif; ?>
                        </div>
                         <?php echo $form->hiddenField($model,'gallery_id');?>
                         <?php echo $form->hiddenField($model,'tmpGallery');?>
                        <a href="#modal-form" role="button" class="blue" data-toggle="modal">
                           <button class="btn btn-small btn-primary">Choose Gallery</button>
                        </a>
                        <span class="help-inline"><?php echo $form->error($model, 'gallery_id'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelEx($model, 'hot', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <div class="span3">
                            <label>
                                <?php echo $form->checkBox($model,'hot', array('class' => 'ace-checkbox-2')); ?>
                                
                                <span class="lbl"></span>
                            </label>
                        </div>
                        <span class="help-inline"><?php echo $form->error($model, 'hot'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($model, 'cover_image', array('class' => 'control-label')); ?>
                    <div class="controls">
                        <?php echo $form->fileField($model, 'cover_image', array('class' => 'id-input-file-1 span5')); ?>
                        <span class="help-inline" style="float:left;margin-left:390px;"><?php echo $form->error($model, 'cover_image'); ?></span>
                    </div>
                </div>
                <div class="control-group">
                    <?php echo $form->labelex($translate, 'description', array('class' => 'control-label')); ?>
                    <div class="controls">

                        <span class="help-inline"><?php echo $form->error($translate, 'description'); ?></span>
                    </div>
                </div>

                <?php
                $this->widget('ext.editMe.ExtEditMe', array(
                    'model' => $translate,
                    'height' => '250px',
                    'width' => '100%',
                    'attribute' => 'description',
                    'toolbar' => Yii::app()->params['ckeditor'],
                    'filebrowserBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html',
                    'filebrowserImageBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Images',
                    'filebrowserFlashBrowseUrl' => Yii::app()->baseUrl . '/ckfinder/ckfinder.html?type=Flash',
                    'filebrowserUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
                    'filebrowserImageUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
                    'filebrowserFlashUploadUrl' => Yii::app()->baseUrl . '/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash',
                ));
                ?>
                <div class="form-actions">
                    <button class="btn btn-info" type="submit">
                        <i class="icon-ok bigger-110"></i>
                        Submit
                    </button>
                    &nbsp; &nbsp; &nbsp;
                    <button class="btn" type="reset">
                        <i class="icon-undo bigger-110"></i>
                        Reset
                    </button>
                </div>
    </div>
</div>

 <?php $this->endWidget(); ?>
<script src="<?php echo Yii::app()->theme->baseUrl; ?>/backend/tag/bootstrap-tagsinput.js"></script>
<link rel="stylesheet" href="<?php echo Yii::app()->theme->baseUrl; ?>/backend/tag/bootstrap-tagsinput.css">
<style>
    .control-group span.required,.errorMessage {color:red;}
    .bootstrap-tagsinput {width:365px;margin-top:5px;}
    .ace-file-input {width: 380px;height: auto;}

</style>

<?php echo $this->renderPartial('_popup', array('model'=>$model)); ?>